<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="common/header.jsp" %>	
            <div class="clearfix"></div>

            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Button Example <small>Users</small></h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                      <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                        <ul class="dropdown-menu" role="menu">
                          <li><a href="#">Settings 1</a>
                          </li>
                          <li><a href="#">Settings 2</a>
                          </li>
                        </ul>
                      </li>
                      <li><a class="close-link"><i class="fa fa-close"></i></a>
                      </li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                     <p class="text-muted font-13 m-b-30">
                      	如下：<br>
                      	Copy:功能暂未完成<br>
                      	CSV:可以将所显示表以.csv的文件下载<br>
                      	Print:打印功能<br>
                      	Search:可根据条件查询
                    </p>
                    <table id="datatable-buttons" class="table table-striped table-bordered">
                      <thead>
                        <tr>
                          <th>学生姓名</th>
                          <th>年龄</th>
                          <th>性别</th>
                          <th>学历</th>
                          <th>身份证</th>
                          <th>现住址</th>
                          <th>联系方式</th>
                          <th>操作</th>
                        </tr>
                      </thead>

                     <tbody>
                     <c:forEach var="student" items="${studentList}">
                        <tr>
                          <td>${student.studentName}</td>
                          <td>${student.age}</td>
                          <td>${student.sex}</td>
                          <td>${student.educationBackground}</td>
                          <td>${student.identityCard}</td>
                          <td>${student.address}</td>
                          <td>${student.phone}</td>
                          <td>
							<a href="#" class="btn btn-primary btn-xs" data-toggle="modal" onclick="min(${student.id})">查看</a>
                            <a href="#" class="btn btn-info btn-xs"><i class="fa fa-pencil"></i> 修改 </a>    
                          </td>
                        </tr>
						</c:forEach>                        	
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
           </div>
       </div>
							<!--
                            	作者：offline
                            	时间：2017-08-31
                            	描述：
                       -->        
      <div id="mind" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true">
          <div class="modal-dialog modal-lg">
              <div class="modal-content">
				
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
                  </button>
                  <h4 class="modal-title" id="myModalLabel">基本信息</h4>
                </div>
                <div id="studentInfo" class="modal-dialog">
                 <!-- <h3 style="align-self: center;">Text in a modal:<b>->&ensp;&ensp;&ensp;</b><span style="color:#0000FF;">张小江</span></h3> -->
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>

              </div>      
            </div>
          </div>
        <!-- /page content -->

        <!-- footer content -->
       <footer>
          <div class="pull-right">
            Gentelella - Bootstrap Admin Template by <a href="https://colorlib.com">Colorlib</a>
          </div>
          <div class="clearfix"></div>
        </footer>
        <!-- /footer content -->
      </div>
    </div>
		<%@ include file="common/js.jsp" %>
    <!-- Datatables -->
    <script type="text/javascript">
    	function min(id){
    		$.ajax({
	   			type:"GET",
	   			url:"/ApplySystem/sys/student/findStudnetById.json",
	   			data:{id:id},
	   			datatype:"json",
	   			success:function(data){
	   				$("#studentInfo").html("");
	   				var state = null;
	   				var computerSavvy = null;
	   				var sex = null;
	   				if(data.student.sex == 1){
	   					sex = "男";
	   				}else{
	   					sex = "女";
	   				}
	   				if(data.student.computerSavvy == 0){
	   					computerSavvy = "零基础";
	   				}else if(data.student.computerSavvy == 1){
	   					computerSavvy = "一般";
	   				}else{
	   					computerSavvy = "资深";
	   				}
	   				if(data.student.state == 0){
	   					state = "未提交";
	   				}else if(data.student.state == 1){
	   					state = "待审核";
	   				}else{
	   					state = "已提交";
	   				}
	   				var student = "<h3 align='left'>&emsp;&emsp;&emsp;&emsp;&emsp;姓名：<b>&ensp;&ensp;&ensp;</b><span style='color:#0000FF;'>"+data.student.studentName+"</span></h3>"
	   							  +"<h3 align='left'>&emsp;&emsp;&emsp;&emsp;&emsp;性别：<b>&ensp;&ensp;&ensp;</b><span style='color:#0000FF;'>"+sex+"</span></h3>"
	   							  +"<h3 align='left'>&emsp;&emsp;&emsp;&emsp;&emsp;年龄：<b>&ensp;&ensp;&ensp;</b><span style='color:#0000FF;'>"+data.student.age+"</span></h3>"
	   							  +"<h3 align='left'>&emsp;&emsp;&emsp;&emsp;&emsp;学历：<b>&ensp;&ensp;&ensp;</b><span style='color:#0000FF;'>"+data.student.educationBackground+"</span></h3>"
	   							  +"<h3 align='left'>&emsp;&emsp;&emsp;&emsp;身份证：<b>&ensp;&ensp;&ensp;</b><span style='color:#0000FF;'>"+data.student.identityCard+"</span></h3>"
	   							  +"<h3 align='left'>&emsp;&emsp;&emsp;&emsp;现住址：<b>&ensp;&ensp;&ensp;</b><span style='color:#0000FF;'>"+data.student.address+"</span></h3>"
	   							  +"<h3 align='left'>&emsp;&emsp;&emsp;出生日期：<b>&ensp;&ensp;&ensp;</b><span style='color:#0000FF;'>"+data.birthday+"</span></h3>"
	   							  +"<h3 align='left'>&emsp;&emsp;&emsp;联系方式：<b>&ensp;&ensp;&ensp;</b><span style='color:#0000FF;'>"+data.student.phone+"</span></h3>"
	   							  +"<h3 align='left'>计算机了解程度：<b>&ensp;&ensp;&ensp;</b><span style='color:#0000FF;'>"+computerSavvy+"</span></h3>"
	   							  +"<h3 align='left'>&emsp;&emsp;&emsp;&emsp;&emsp;班级：<b>&ensp;&ensp;&ensp;</b><span style='color:#0000FF;'>"+data.student.grade.gradeName+"</span></h3>"
	   							  +"<h3 align='left'>&emsp;&emsp;&emsp;&emsp;班主任：<b>&ensp;&ensp;&ensp;</b><span style='color:#0000FF;'>"+data.student.grade.user.name+"</span></h3>"
	   							  +"<h3 align='left'>&emsp;&emsp;&emsp;&emsp;&emsp;状态：<b>&ensp;&ensp;&ensp;</b><span style='color:#0000FF;'>"+state+"</span></h3>"
	   							  +"<h3 align='left'>&emsp;&emsp;&emsp;&emsp;咨询师：<b>&ensp;&ensp;&ensp;</b><span style='color:#0000FF;'>"+data.student.user.name+"</span></h3>"
	   							  ;
	   				$("#studentInfo").html(student);
	   				$("#mind").modal('show'); 
	   			},
	   			error:function(data){
	   				alert("请求异常");
	   			} 
	   		}); 
    	}
      $(document).ready(function() {
        var handleDataTableButtons = function() {
          if ($("#datatable-buttons").length) {
            $("#datatable-buttons").DataTable({
              dom: "Bfrtip",
              buttons: [
                {
                  extend: "copy",
                  className: "btn-sm"
                },
                {
                  extend: "csv",
                  className: "btn-sm"
                },
                {
                  extend: "excel",
                  className: "btn-sm"
                },
                {
                  extend: "pdfHtml5",
                  className: "btn-sm"
                },
                {
                  extend: "print",
                  className: "btn-sm"
                },
              ],
              //responsive: true
            });
          }
        };

        TableManageButtons = function() {
          "use strict";
          return {
            init: function() {
              handleDataTableButtons();
            }
          };
        }();

			 $('#datatable').dataTable();

        $('#datatable-keytable').DataTable({
          keys: true
        });

        $('#datatable-responsive').DataTable();

        $('#datatable-scroller').DataTable({
          ajax: "js/datatables/json/scroller-demo.json",
          deferRender: true,
          scrollY: 380,
          scrollCollapse: true,
          scroller: true
        });

        $('#datatable-fixed-header').DataTable({
          fixedHeader: true
        });

        var $datatable = $('#datatable-checkbox');

        $datatable.dataTable({
          'order': [[ 1, 'asc' ]],
          'columnDefs': [
            { orderable: false, targets: [0] }
          ]
        });
        $datatable.on('draw.dt', function() {
          $('input').iCheck({
            checkboxClass: 'icheckbox_flat-green'
          });
        });

        TableManageButtons.init();
      });
    </script>
    <!-- /Datatables -->
  </body>
</html>